$(function(){
          
          $(".turnimgs").css({"height":$(window).height()-115}); //使轮播图片自适应
          $(".turnpicture").flexslider({
            slideshowSpeed: 3000, //展示时间间隔ms
            animationSpeed: 1000, //滚动时间ms
            touch: true, //是否支持触屏滑动
            directionNav:true,
            animation:"fade",
            easing:"swing"
          });
    
         //创新信息模块隐藏和显示
          $(".imgicon").add(".createCenter h2").add(".createCenter p").hover(function(){
                $(".createCenter_content").slideDown("slow");
                $(".main").css({"transform":"rotate(0deg)","transform":"scaleX(1.4)"});
                $(".two-td").css({"letter-spacing":"0px"})
                $(".createCenter_content .main").hover(function(){

                },function(){
                     $(".createCenter_content").slideUp("slow");
                     $(".main").css({"transform-origin":"0% 100%","transform":"rotate(30deg)"});
                })
          })
          function info(){
             if($(document).height()>=2500){
                   if($(this).scrollTop()>1500&&$(this).scrollTop()<1800){
                       $(".hiddenpage").show();
                   }
               }else{
                   if($(this).scrollTop()>1100&&$(this).scrollTop()<1300){
                       $(".hiddenpage").show();
                   }
               }

               $(".infodiv span").click(function(){
                    $(".hiddenpage").hide();
                    $(window).unbind("scroll");
               })
          }
          $(window).bind("scroll",info);
         
          var datastr;
          var number=["first","second","third","forth"];
          var listdiv={"first-li":"aie_news","second-li":"print_news","third-li":"department","forth-li":"record"};
          var arr=["article.shtml","department.shtml","compete.shtml","download.shtml","about.shtml"];
          //被绑定执行的行数，获取栏目的内容列表
          function get_list(event){
              var datastr="type=COLUMN&bool=true&pageNo=1&columnId="+$(this).attr("id")+"&modelId="+$(this).attr("modelId");                  
              var thisobj=$(this);
              $.post(serverIp+"/Scauaie.com/artical/showAll",datastr,function(data){
                   var dataobj=JSON.parse(data);
                   $.each(dataobj,function(index,value){
                 
                       if(event.data.number==1){  //公告等模块
                             var liClass=thisobj.attr("class");                      
                             if(index<3){ 
                                 $("."+listdiv[liClass]).find("tbody").append("<tr class='"+index+"'></tr>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td1'><span class='pre5info'>"+(index+1)+"</span></td>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td2'><a href='articlecontent.shtml?"+value.id+"'>"+value.title+"</a></td>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td3'><span>"+value.releaseDate+"</span></td>")
                                
                             }else if(index<7){
                                 $("."+listdiv[liClass]).find("tbody").append("<tr class='"+index+"'></tr>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td1'><span>"+(index+1)+"</span></td>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td2'><a href='articlecontent.shtml?"+value.id+"'>"+value.title+"</a></td>");
                                 $("."+listdiv[liClass]).find("."+index).append("<td class='td3'><span>"+value.releaseDate+"</span></td>")
                             }       
                       }else if(event.data.number==2){  //创新信息
                            if(index<8){
                                 thisobj.find("tbody").append("<tr class='"+index+"'></tr>");
                                 thisobj.find("."+index).append("<td class='one-td'><a href='articlecontent.shtml?"+value.id+"'>"+value.title+"</a></td>");
                                 thisobj.find("."+index).append("<td class='two-td'>"+value.releaseDate+"</td>");
                            }
                                 
                       }else if(event.data.number==3){ //创新创业论坛
                           if(index<6){
                              var hopen="<h"+(index+1)+">";
                              var hclose="</h"+(index+1)+">";
                              thisobj.find("ul").append("<li>"+hopen+"<span class='span_one'><a>"+value.title+"</span><span class='span_two'>"+value.releaseDate+"</a></span>"+hclose+"</li>");
                           }          
                       }else{
                             thisobj.find("ul").append("<li><a href='imgcontent.shtml?"+value.id+"'><img src='"+value.poster+"'></a></li>");
                       }
                                                
                   })
              },"html");                   
          }
       

        //获取所有一级栏目
         $.post(serverIp+"/Scauaie.com/artical/coumns/show",null,function(data){
              var dataobj=JSON.parse(data);
              $.each(dataobj,function(index,value){
                  if(index<5){
                        $("#top_nav").append("<li id='"+value.id+"' modelId='"+value.modelId+"' ><a href='"+arr[index]+"?"+value.id+"&"+value.modelId+"'>"+value.name+"</a></li>")
                   }
                   if(value.modelId==6){
                       $(".slides").attr({"modelId":value.modelId,"id":value.id});
                       news=$("#index").next().html();
                   }
              }) 

              //请求轮播图
            //   var subarr=['one-img','two-img','three-img'];
            //  var datastr="type=COLUMN&bool=true&pageNo=1&columnId="+$(".slides").attr("id")+"&modelId="+$(".slides").attr("modelId");
            // $.post(serverIp+"/Scauaie.com/artical/showAll",datastr,function(data){
            //       var dataobj=JSON.parse(data);
                  
            //       $.each(dataobj,function(index,value){
            //           if(index<3){
            //                $(".slides").find("#"+subarr[index]).attr({"id":value.pictureArticle_id,"src":serverIp+"/Scauaie.com"+value.pictureUrl});
            //            }
            //       }) 
            //   },"html");
             
              //请求动态新闻子栏目
              datastr="id="+$("#index").nextAll(":contains('新闻动态')").attr('id');
              $.post(serverIp+"/Scauaie.com/artical/coumns/showchild",datastr,function(data){                 
                   var dataobj=JSON.parse(data);
                   var i=0;
                   $.each(dataobj,function(index,value){ 
                       switch(value.name){
                           case "公告":$(".article_header").find("ul").append("<li id='"+value.id+"' modelId='"+value.modelId+"' class='"+(number[i++]+"-li")+"'><h2>"+value.name+"</h2><a href=''  class='more'>Read More</a></li>");break;
                           case "科联新闻":$(".article_header").find("ul").append("<li id='"+value.id+"' modelId='"+value.modelId+"' class='"+(number[i++]+"-li")+"'><h2>"+value.name+"</h2><a href=''  class='more'>Read More</a></li>");break;
                           case "媒体科联":$(".article_header").find("ul").append("<li id='"+value.id+"' modelId='"+value.modelId+"' class='"+(number[i++]+"-li")+"'><h2>"+value.name+"</h2><a href=''  class='more'>Read More</a></li>");break;
                           case "会议记录":$(".article_header").find("ul").append("<li id='"+value.id+"' modelId='"+value.modelId+"' class='"+(number[i++]+"-li")+"'><h2>"+value.name+"</h2><a href=''  class='more'>Read More</a></li>");break;
                           case "创新信息":$(".content_left").attr({"id":value.id,"modelId":value.modelId});break;
                           case "科技创新创业论坛":$(".luntan_main").attr({"id":value.id,"modelId":value.modelId});break;
                       }
                   })

                    //给六个模块绑定事件并执行
                    $(".first-li").one("click",{"number":1},get_list);  
                    $(".second-li").one("click",{"number":1},get_list); 
                    $(".third-li").one("click",{"number":1},get_list);                 
                    $(".forth-li").one("click",{"number":1},get_list); 
                    $(".content_left").one("click",{"number":2},get_list);
                    $(".luntan_main").one("click",{"number":3},get_list);      
                    $(".first-li").trigger("click");
                    $(".second-li").trigger("click");
                    $(".third-li").trigger("click");
                    $(".forth-li").trigger("click");
                    $(".content_left").trigger("click"); 
                    $(".luntan_main").trigger("click");

                   //给该栏目加动态效果
                    $(".article_header li").hover(function(){
                         $(this).find("h2").css({"font-size":"2.2em","transform":"rotate(360deg)"})
                    },function(){
                         $(this).find("h2").css({"font-size":"1.5em","transform":"rotate(0deg)"})
                    })
                    $(".first-li").hover(function(){
                          $('.print_news').fadeOut("fast");
                          $('.aie_news').fadeIn("slow");
                    },function(){})
                     $(".second-li").hover(function(){
                          $('.aie_news').fadeOut("fast");
                          $('.print_news').fadeIn("slow");
                    },function(){})
                      $(".third-li").hover(function(){
                          $('.record').fadeOut("fast");
                          $('.department').fadeIn("slow");
                    },function(){})
                    $(".forth-li").hover(function(){
                          $('.department').fadeOut("fast");
                          $('.record').fadeIn("slow");
                    },function(){});

              },"html");
               
               //科技作品模块
              datastr="id="+$("#index").nextAll(":contains('学术比赛')").attr('id');
              $.post(serverIp+"/Scauaie.com/artical/coumns/showchild",datastr,function(data){                 
                   var dataobj=JSON.parse(data); 
                   $.each(dataobj,function(index,value){
                       if(value.name=="课外学术科技作品"){
                            $(".content_right").attr({"id":value.id,"modelId":value.modelId});
                       }
                   })
                   $(".content_right").one("click",{"number":4},get_list);
                   $(".content_right").trigger("click");      
             },"html");
    

          },"html");

    })